#include "Scene.h"

Scene::Scene(char const* bgfile, char const*mapfile) :
  Background(NULL),
  Map(NULL)
{
  // rjr: sure there's a better way but I write too much C
  // jms: do you also leak so much memory?  i fixed your delete bugs...:P
  int len = strlen(bgfile);
  BackgroundImageFile = new char[len];
  if (BackgroundImageFile)
    strcpy(BackgroundImageFile,bgfile);
  else
    cout << "BackgroundImageFile not allocated\n" << endl;
  len = strlen(mapfile);
  MapImageFile = new char[len];
  if (MapImageFile)
    strcpy(MapImageFile,mapfile);
  else
    cout << "MapImageFile not allocated\n" << endl;
  MapRect.x = MAP_POS_X;
  MapRect.y = MAP_POS_Y;
  MapRect.w = MAP_SIZE_X;
  MapRect.h = MAP_SIZE_Y;
}

Scene::~Scene() {
  if (BackgroundImageFile) delete[] BackgroundImageFile;
  if (Background) SDL_FreeSurface(Background);
  if (MapImageFile) delete[] MapImageFile;
  if (Map) SDL_FreeSurface(Map);
}

